#define _CRT_SECURE_NO_WARNINGS 1

#include "List.h"

void TestList1() 
{
    DLNode* pList = DListInit();
    DListPushBack(pList, 1);
    DListPushBack(pList, 2);
    DListPushBack(pList, 3);
    DListPushBack(pList, 4);
    DListPrint(pList);

    DListPopBack(pList);
    DListPopBack(pList);
    DListPrint(pList);
}

void TestList2()
{
    DLNode* pList = DListInit();
    DListPushFront(pList, 1);
    DListPushFront(pList, 2);
    DListPushFront(pList, 3);
    DListPushFront(pList, 4);
    DListPrint(pList);

    DListPopFront(pList);
    DListPopFront(pList);
    DListPrint(pList);
}

void TestList3()
{
    DLNode* pList = DListInit();
    DListPushBack(pList, 1);
    DListPushBack(pList, 2);
    DListPushBack(pList, 3);
    DListPushBack(pList, 4);
    DListPrint(pList);

    DLNode* pos = DListFind(pList, 1);
    DListInsert(pos, 60);
    DListPrint(pList);

    pos = DListFind(pList, 4);
    DListInsert(pos, 70);
    DListPrint(pList);
    
    pos = DListFind(pList, 2);
    DListEarse(pos);
    DListPrint(pList);

    pos = DListFind(pList, 4);
    DListEarse(pos);
    DListPrint(pList);

    pos = DListFind(pList, 60);
    DListEarse(pos);
    DListPrint(pList);

    DListDestory(pList);
    pList = NULL;
}

int main() 
{
    //TestList1();
    //TestList2();
    TestList3();
    return 0;
}